package bb.lanxing.lib.devices.ble.ble.characteristic.hr;

import android.bluetooth.BluetoothGatt;
import android.bluetooth.BluetoothGattCharacteristic;
import bb.lanxing.lib.devices.ble.ble.base.BaseBleCharacteristic;
import bb.lanxing.lib.devices.ble.ble.base.BaseBleService;
import bb.lanxing.lib.devices.core.provider.DataNotifier;
import java.util.UUID;
import kotlin.Metadata;
import kotlin.jvm.internal.Intrinsics;

public final class HeartRateMeasurementCharacteristics extends BaseBleCharacteristic {
    public HeartRateMeasurementCharacteristics(BaseBleService bleService) {
        super(bleService);
        Intrinsics.checkNotNullParameter(bleService, "bleService");
    }

    @Override
    public UUID targetUUID() {
        UUID fromString = UUID.fromString("00002a37-0000-1000-8000-00805f9b34fb");
//        Intrinsics.checkNotNullExpressionValue(fromString, "fromString(BLEAttributes…E_HEART_RATE_MEASUREMENT)");
        return fromString;
    }

    @Override
    public void onValueUpdate(BluetoothGatt gatt, BluetoothGattCharacteristic characteristic) {
        int intValue;
//        Intrinsics.checkNotNullParameter(gatt, "gatt");
//        Intrinsics.checkNotNullParameter(characteristic, "characteristic");
        if ((characteristic.getIntValue(17, 0) & 1) == 0) {
            Integer intValue2 = characteristic.getIntValue(17, 1);
//            Intrinsics.checkNotNullExpressionValue(intValue2, "{\n            characteri…ORMAT_UINT8, 1)\n        }");
            intValue = intValue2;
        } else {
            Integer intValue3 = characteristic.getIntValue(18, 1);
//            Intrinsics.checkNotNullExpressionValue(intValue3, "{\n            characteri…RMAT_UINT16, 1)\n        }");
            intValue = intValue3;
        }
        DataNotifier.notifyHeartrateData(getBleService().getDevice().getType(), getBleService().getDevice().getAddress(), intValue);
    }
}
